package com.tj.collection.db.dao.impl;
import com.fqgj.common.api.Page;
import com.fqgj.common.base.AbstractBaseMapper;
import com.google.common.collect.Maps;
import com.tj.collection.db.dao.RewardLevelInfoDao;
import com.tj.collection.db.entity.RewardLevelInfoEntity;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
* User: linqu
* Date: 2023-10-05
* Time: 16:11:55.736
*/

@Repository
public class RewardLevelInfoDaoImpl extends AbstractBaseMapper<RewardLevelInfoEntity> implements RewardLevelInfoDao {

    @Override
    public List<RewardLevelInfoEntity> listRewardLevelInfo(List<String> userCodes, Date startDate, Date endDate, Page page) {

        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("userCodes", userCodes);
        params.put("startDate", startDate);
        params.put("endDate", endDate);
        if (page != null) {
            params.put("page", page);
        }
        return this.getSqlSession().selectList(this.getStatement("listRewardLevelInfo"), params);
    }

    @Override
    public int getRewardLevelInfoCnt(List<String> userCodes, Date startDate, Date endDate, Page page) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("userCodes", userCodes);
        params.put("startDate", startDate);
        params.put("endDate", endDate);
        if (page != null) {
            params.put("page", page);
        }
        return this.getSqlSession().selectOne(this.getStatement("listRewardLevelInfoCnt"), params);
    }
}